<%@page import="edcom.server.*"%>
<%@page import="edcom.client.*" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>requestAddStudent</title>
</head>
 <body>

<h1>TESTBENCH</h1>
<h3>getImagesFromServer()</h3>
<a href="index.jsp">RETURN</a>
<br /><br />

<!-- (DevTeam, be sure to clear the tables before accessing this page.) -->

function declaration:<br/>
<br/>
<br/>
<code>TaggedImage[] getImagesFromServer(String classid)</code><br/>
<br/>
returns: &nbsp;
	<ul>
		<li>an array of <code>TaggedImages</code> when parameter <code>classid</code> exists</li>
		<li><code>null</code> when parameter <code>classid</code> does not exist</li>
		<li><code>null</code> when parameter <code>classid</code> is null</li>
	</ul>

<br/><br/>
<b>Run #1 :: returns rows</b><br/>
reason: existing <code>classid</code> parameter (<code>classid = "demo"</code>)
<%
ImageServiceImpl impl = new ImageServiceImpl();
TaggedImage[] results = impl.getImagesFromServer("demo");

out.println("<table border='1'>");

if(results != null) {
	out.print("<tr><td>");
	out.print("id");
	out.print("</td>");
	out.print("<td>");
	out.print("extension");
	out.print("</td>");
	out.print("<td>");
	out.print("course");
	out.print("</td>");
	out.print("<td>");
	out.print("title");
	out.print("</td>");
	out.print("<td>");
	out.print("description");
	out.print("</td></tr>");
	out.println();
	int i = 0;
	while(i < results.length - 1) {
		out.print("<tr><td>");
		out.print(results[i].getId());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getExtension());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getClassName());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getName());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getDescription());
		out.print("</td></tr>");
		out.println();
		i++;
	}
} else {
	out.print("<tr><td>null</td></tr>");
}

out.println("</table>");
%>

<br/><br/>
<b>Run #2 :: returns null</b><br/>
reason: there are no images registered to <code>classid</code> parameter (<code>classid = "unregistered"</code>)
<%
impl = new ImageServiceImpl();
results = impl.getImagesFromServer("unregistered");

out.println("<table border='1'>");

if(results != null) {
	out.print("<tr><td>");
	out.print("id");
	out.print("</td>");
	out.print("<td>");
	out.print("extension");
	out.print("</td>");
	out.print("<td>");
	out.print("course");
	out.print("</td>");
	out.print("<td>");
	out.print("title");
	out.print("</td>");
	out.print("<td>");
	out.print("description");
	out.print("</td></tr>");
	out.println();
	int i = 0;
	while(i < results.length - 1) {
		out.print("<tr><td>");
		out.print(results[i].getId());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getExtension());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getClassName());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getName());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getDescription());
		out.print("</td></tr>");
		out.println();
		i++;
	}
} else {
	out.print("<tr><td>null</td></tr>");
}

out.println("</table>");
%>

<br/><br/>
<b>Run #3 :: returns null</b><br/>
reason: <code>classid</code> parameter is null (<code>classid = null</code>)
<%
impl = new ImageServiceImpl();
results = impl.getImagesFromServer(null);

out.println("<table border='1'>");

if(results != null) {
	out.print("<tr><td>");
	out.print("id");
	out.print("</td>");
	out.print("<td>");
	out.print("extension");
	out.print("</td>");
	out.print("<td>");
	out.print("course");
	out.print("</td>");
	out.print("<td>");
	out.print("title");
	out.print("</td>");
	out.print("<td>");
	out.print("description");
	out.print("</td></tr>");
	out.println();
	int i = 0;
	while(i < results.length - 1) {
		out.print("<tr><td>");
		out.print(results[i].getId());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getExtension());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getClassName());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getName());
		out.print("</td>");
		out.print("<td>");
		out.print(results[i].getDescription());
		out.print("</td></tr>");
		out.println();
		i++;
	}
} else {
	out.print("<tr><td>null</td></tr>");
}

out.println("</table>");
%>

<br/>
<br/>

</body>
</html>